public class StudentService {
    // This could be a list of students, but in real applications, this would likely be a database.
    private List<Student> students;

    public StudentService() {
        students = new ArrayList<>();
    }

    // Method to add a new student
    public void addStudent(Student student) {
        students.add(student);
    }

    // Method to get a student by ID
    public Student getStudentById(String studentId) {
        for (Student student : students) {
            if (student.getStudentId().equals(studentId)) {
                return student;
            }
        }
        return null; // Return null if no student is found
    }

    // Method to update student hobbies
    public void updateStudentHobbies(String studentId, String newHobbies) {
        Student student = getStudentById(studentId);
        if (student != null) {
            student.setHobbies(newHobbies);
        }
    }

    // Method to remove a student
    public boolean removeStudent(String studentId) {
        return students.removeIf(student -> student.getStudentId().equals(studentId));
    }

    // Method to print all students' information
    public void printAllStudentsInfo() {
        for (Student student : students) {
            student.printStudentInfo();
            System.out.println(); // Separate each student's info with a newline
        }
    }
}